<!--
**********************************************************
* @Author: 张小平
* @Date:   2024-05-01
* @Email:  qqshuqian@163.com
* @Last modified: 最后修改日期
* @Description: 文件描述
**********************************************************
-->
<template>
  <div class="iconwarp">
    <img v-if="name === 'word'" class="icon" src="./img/word.png" />
    <img v-else-if="name === 'excel'" class="icon" src="./img/excel.png" />
    <img v-else-if="name === 'ppt'" class="icon" src="./img/ppt.png" />
    <img v-else class="icon" src="./img/default.png" />
  </div>
</template>

<script>
export default {
  props: ['mime'],
  data() {
    return {
    }
  },
  computed: {
    name() {
      let name = 'default'
      switch (this.mime) {
        case 'application/msword':
        case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
          name = 'word'
          break
        case 'application/vnd.ms-excel':
        case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
          name = 'excel'
          break
        case 'application/vnd.ms-powerpoint':
        case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
          name = 'ppt'
          break
      }
      return name
    }
  }
}
</script>

<style lang="scss" scoped>
.iconwarp {
  display: flex;
  align-items: center;
}
.icon {
  width: 22px;
}
</style>
